/* GUI CONVERTED from rcctiq.p (converter v1.75) Tue Apr 10 12:03:33 2001 */
/* rcctiq.p - PART / CONTAINER INQUIRY                                        */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.10 $                                                         */
/*V8:ConvertMode=Report                                                       */
/*V8:DontRefreshTitle=b                                                       */
/* VERSION 7.5        LAST MODIFIED: 03/21/95   BY: GWM  *J049*               */
/* VERSION 8.5        LAST MODIFIED: 07/25/96   BY: jpm  *J11D*               */
/* VERSION 8.6        LAST MODIFIED: 04/02/97   BY: *K09H* Vinay Nayak-Sujir  */
/* VERSION 8.6        LAST MODIFIED: 10/11/97   BY: GYK            *K0WF*     */
/* VERSION 8.6E       LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane          */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane   */
/* REVISION: 9.1      LAST MODIFIED: 08/10/00   BY: *M0QW* Falguni Dalal      */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* Mark Brown         */
/* $Revision: 1.10 $    BY: Jean Miller    DATE: 03/22/01 ECO: *P008*        */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rcctiq_p_1 "Top Level"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_2 "Top Level Only"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_3 "UM"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_4 "Quantity"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_5 "Site"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_6 "Item Number"
/* MaxLen: Comment: */

&SCOPED-DEFINE rcctiq_p_7 "Container"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/* LOCAL VARIABLES */
define variable part like pt_part label {&rcctiq_p_6} no-undo.
define variable part1 as character no-undo.
define variable site like abs_site label {&rcctiq_p_5} no-undo.
define variable site1 as character no-undo.
define variable toplevel_only like mfc_logical label {&rcctiq_p_2}
                                   initial true no-undo.
define variable last_part like abs_item no-undo.
define variable cont_id   like abs_id label {&rcctiq_p_7} no-undo.
define variable cont_item like abs_item no-undo.
define variable disp_abs_id as character format "X(10)" no-undo.

/* BUFFERS */
define buffer abs_parent for abs_mstr.
define buffer abs_child for abs_mstr.


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   part
   site
   toplevel_only
with frame a width 80 attr-space no-underline THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

assign
   part = global_part
   site = global_site.

{wbrp01.i}

mainloop:
repeat:

   assign
      last_part = ""
      part1 = hi_char
      site1 = hi_char.

   if c-application-mode <> "WEB" then
   update
      part
      site
      toplevel_only
   with frame a editing:

      if frame-field = "part" then do:

         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i pt_mstr part pt_part part pt_part pt_part}

         if recno <> ? then do:
            part = pt_part.
            display
               part
            with frame a.
         end.
      end. /* IF FRAME-FIELD = "PART" */

      else if frame-field = "site" then do:

         /* FIND NEXT/PREVIOUS RECORD */
         {mfnp.i si_mstr site si_site site si_site si_site}

         if recno <> ? then do:
            site = si_site.
            display
               site
            with frame a.
         end.
      end. /* IF FRAME-FIELD = "SITE" */

      else do:
         status input.
         readkey.
         apply lastkey.
      end.
   end. /* UPDATE EDITING */

   {wbrp06.i &command = update &fields = "  part site toplevel_only"
             &frm = "a"}

   /* OUTPUT DESTINATION SELECTION */
   {gpselout.i &printType = "terminal"
               &printWidth = 80
               &pagedFlag = " "
               &stream = " "
               &appendToFile = " "
               &streamedOutputToTerminal = " "
               &withBatchOption = "no"
               &displayStatementType = 1
               &withCancelMessage = "yes"
               &pageBottomMargin = 6
               &withEmail = "yes"
               &withWinprint = "yes"
               &defineVariables = "yes"}

   if input part <> "" then do:
      assign
         part1 = part
         global_part = input part.
   end.

   if input site <> "" then do:
      assign
         site1 = site
         global_site = input site.
   end.

   /* DEFINE FRAME B FOR DOWN FRAME DISPLAY */
   do with frame b:

      clear frame b no-pause.

      disp_recs:
      for each abs_mstr where
               abs_type = "s" and
               abs_item >= part and abs_item <= part1
           and abs_site >= site and abs_site <= site1
           and abs_id begins "ic"
      no-lock by abs_item by abs_par_id by abs_site by abs_loc:

         /* FIND PARENT CONTAINER RECORD */
         find abs_parent
         where abs_parent.abs_shipfrom = abs_mstr.abs_shipfrom
           and abs_parent.abs_id = abs_mstr.abs_par_id
         no-lock no-error.

         if not available abs_parent then
            next disp_recs.

         assign
            cont_id = substring(abs_parent.abs_id,2)
            cont_item = abs_parent.abs_item.

         /* FIND TOP LEVEL CONTAINER */
         do while abs_parent.abs_par_id <> "":

            find abs_child
            where recid(abs_child) = recid(abs_parent) no-lock.

            find abs_parent
            where abs_parent.abs_shipfrom = abs_child.abs_shipfrom
              and abs_parent.abs_id = abs_child.abs_par_id
            no-lock no-error.

            if not available abs_parent then
               next disp_recs.

         end.

         /* IF TOP LEVEL A SHIPPER AND NOT TOP LEVEL ONLY */
         /*  THEN CANNOT USE THIS ONE */
         if not abs_parent.abs_id begins "C"
            and toplevel_only
         then
            next disp_recs.

         disp_abs_id = caps(substring(abs_parent.abs_id,1,1)) +
                       substring(abs_parent.abs_id,2).

         /* DISPLAY THE RECORD */
         /* SET EXTERNAL LABELS */
         setFrameLabels(frame b:handle).

         display
            space(1)
            cont_item
            cont_id
            abs_mstr.abs_site
            abs_mstr.abs_loc
            abs_mstr.abs_qty                   label {&rcctiq_p_4}
            abs_mstr.abs__qad02 format "XX"    label {&rcctiq_p_3}
            disp_abs_id         format "x(10)" label {&rcctiq_p_1}
               when (substring(abs_parent.abs_id,2) <> cont_id)
         with frame b down centered width 80 STREAM-IO /*GUI*/ .

         down 1 with frame b.

         /* SET LAST PART IF DIFFERENT THEN SAVED VALUE */
         if last_part <> abs_mstr.abs_item then do:
            last_part = abs_mstr.abs_item.
         end.

         
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/


      end. /* DISP_RECS */

   end. /* DO WITH FRAME B */

   {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/


end. /* MAINLOOP */

{wbrp04.i &frame-spec = a}
